package com.nbjtjc.safe.service.sys;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.mapper.sys.SysPostResponsibleMapper;
import com.nbjtjc.safe.model.SysPostResponsible;
import com.nbjtjc.safe.model.sys.SysPost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther guqianbin
 * @date 2018/9/5 15:30
 **/
@Service
public class SysPostResponsibleService {
    @Autowired
    private SysPostResponsibleMapper sysPostResponsibleMapper;

    public Result add(SysPostResponsible sysPostResponsible) {
        Result result = new Result();
        sysPostResponsibleMapper.insertSelective(sysPostResponsible);
        result.setData(sysPostResponsible);
        return result;
    }

    public Result update(SysPostResponsible sysPostResponsible){
        sysPostResponsibleMapper.updateByPrimaryKeySelective(sysPostResponsible);
        Result result=new Result();
        result.setData(sysPostResponsible);
        return result;
    }

    public Result find(SysPostResponsible sysPostResponsible) {
        Result result = new Result();
        List<SysPostResponsible> sysPostResponsibles =
                sysPostResponsibleMapper.select(sysPostResponsible);
        result.setData(sysPostResponsibles);
        return result;
    }

    public Result delete(SysPostResponsible sysPostResponsible) {
        Result result = new Result();
        sysPostResponsibleMapper.deleteByPrimaryKey(sysPostResponsible);
        return result;
    }

}
